import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: 'about/:type', // 动态路由 type会成为路由对象中的params参数中的key
        name: 'About',
        component: () => import('../views/About.vue')
      },
      {
        path: 'page',
        name: 'page1',
        component: () => import('../views/page1.vue')
      },
      {
        path: 'page/two',
        name: 'page2',
        component: () => import('../views/page2.vue')
      },
      {
        path: 'page/two/three',
        name: 'page3',
        component: () => import('../views/page3.vue')
      },
      {
        path: 'page/four',
        name: 'page4',
        component: () => import('../views/page4.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
